<?php
    class MysqlRecordSet extends RecordSet implements IRecordSet
    {
        public function __construct(&$database , $query)
        {
            parent::__construct($database , $query);
            
            $this->ReturnNum = mysql_num_rows($query);
        }
        
        public final function fetchObject()
        {
            $value = mysql_fetch_object($this->_result);
            
            if($value === false)
            {
                return false;
            }
            
            return $value;
        }
        
        public final function fetchRow()
        {
            $value = mysql_fetch_row($this->_result);
            
            if($value === false)
            {
                return false;
            }
            
            return $value;
        }
        
        public final function fetchArray($type = FetchType::FM_ARRAY_BOTH)
        {
            switch($type)
            {
                case FetchType::FM_ARRAY_NUMERIC:
                    $value = mysql_fetch_array($this->_result, MYSQL_NUM);
                break;
                case FetchType::FM_ARRAY_ASSOCIATIVE:
                    $value = mysql_fetch_array($this->_result, MYSQL_ASSOC);
                break;
                case FetchType::FM_ARRAY_BOTH:
                    $value = mysql_fetch_array($this->_result , MYSQL_BOTH);
                break; 
            }
            
            if($value === false)
            {
                return false;
            }
            
            return $value;
        }
        
        public final function fetchAssoc()
        {
            $value = mysql_fetch_assoc($this->_result);
            
            if($value === false)
            {
                return false;
            }
            return $value;
        }
    }
?>